package com.pandy.transaction;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.env.Environment;

import java.io.IOException;
import java.util.concurrent.*;

/**
 * @description: Spring事务失效的常见场景
 * @author: panhong
 * @date: 2025/3/19
 */
public class Main {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        UserService userService = (UserService)context.getBean("userService");
        System.out.println(userService.getName());

    }

    public static void test() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        UserService bean = context.getBean(UserService.class);

        //User2Service bean2 = context.getBean(User2Service.class);
        bean.methodB(); //  调用方法
    }
}
